﻿#ifndef UI_PROCESS_H
#define UI_PROCESS_H

/*****************************************************************************************
  @Copyright  2020-2021
  @Date       2021-06-13
  @Author     qiaowei
  @Contact    weiweiqiao@126.com
  @Version    1.0
  @Brief      窗体操作类，将用户在窗体的操作进行分类处理
  @Other      None
  @History    None
  @Functions  None
******************************************************************************************/

#include <QObject>
#include <QThread>

class File_process;
class Track_process;
class Track_data;

class Ui_process : public QObject
{
    Q_OBJECT
public:
    explicit Ui_process(QObject *parent = nullptr);
    ~Ui_process();

    void get_filter_conditions(QMap<QString, QVariant>* filter, QList<Track_data* >* list);

public slots:
    void sl_open_files();
    void sl_split_data_to_files();
    void sl_exit_application();

    /***************************************************************************
     @Date     2021-06-13
     @Author   qiaowei
     @Contact  weiweiqiao@126.com
     @Version  1.0
     @Brief    quit sub thread
     @Param    index thread id
    ***************************************************************************/
    void sl_quit_sub_thread(int index);

signals:
    void si_open_files(QStringList files_name);

    void si_split_data_to_files(QStringList files_name);

    void si_send_track_to_model(Track_data* data);

    void si_clear_model_();

    void si_send_filter_and_track_to_process(QMap<QString, QVariant>* filter,
                                             QList<Track_data* >* list);

    void si_updte_model_by_filter(int row, bool flag);

private:
    void init_connects();

    /***************************************************************************
     @Date     2021-05-23
     @Author   qiaowei
     @Contact  weiweiqiao@126.com
     @Version  1.0
     @Brief    Create a sub thread
     @Param    thread sub thread
     @Param    process pointer moved into sub thread
    ***************************************************************************/
    void start_sub_thread(QThread& thread, QObject* process);

private:
    // 文件处理类及对应子线程
    File_process* file_process_;
    QThread file_thread_;

    // 航迹处理类及对应子线程
    Track_process* track_process_;
    QThread track_thread_;

};

#endif // UI_PROCESS_H
